package com.itgaoshu.hospitalproject.service.impl;

import com.itgaoshu.hospitalproject.bean.Lcheckup;
import com.itgaoshu.hospitalproject.bean.Register;
import com.itgaoshu.hospitalproject.mapper.LoutMapper;
import com.itgaoshu.hospitalproject.service.LoutService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
@Service
@Transactional
public class LoutServiceImpl implements LoutService {
    @Autowired
    private LoutMapper loutMapper;
    //查询已经出院的患者的信息
    @Override
    public List<Register> selRegisters(Register register) {
        return loutMapper.selRegisters(register);
    }

    //查询该患者是否还有药品要取出才能出院
    @Override
    public int selYaos(Register register) {
        return loutMapper.selYaos(register);
    }

    //修改患者出院状态，同时修改患者的床位为空床
    @Override
    public int updateR(Register register) {
        int i = loutMapper.updateR(register);
        int j=0;
        if(i==1){//表明出院成功
            loutMapper.updateB(register);
            j=1;
        }
        return j;
    }

    //查询该患者出院之后的再一次的复查情况
    @Override
    public List<Lcheckup> selCheckup(Register register) {
        return loutMapper.selCheckup(register);
    }
}
